//
//  JokeCell.m
//  项目B
//
//  Created by lanou3g on 16/5/4.
//  Copyright © 2016年 LXK. All rights reserved.
//

#import "JokeCell.h"
#import "UIImageView+WebCache.h"
#import "Tool.h"


@interface JokeCell ()
//头像
@property (weak, nonatomic) IBOutlet UIImageView *headimageView;
//昵称
@property (weak, nonatomic) IBOutlet UILabel *NicknameLabel;
//内容
@property (weak, nonatomic) IBOutlet UILabel *texttitleLabel;
//类型
@property (weak, nonatomic) IBOutlet UILabel *categoryLabel;
//赞
@property (weak, nonatomic) IBOutlet UILabel *diggLabel;
//不赞
@property (weak, nonatomic) IBOutlet UILabel *buryLabel;
//评论数
@property (weak, nonatomic) IBOutlet UILabel *commentlabel;
//分享数
@property (weak, nonatomic) IBOutlet UILabel *shareLabel;

@end

@implementation JokeCell


-(void)setModel:(JokeModel *)model
{
    _model = model;
}
- (void)layoutSubviews {
    
    
//    self.categoryLabel.numberOfLines = 0; // 需要把显示行数设置成无限制
//    self.categoryLabel.textAlignment = NSTextAlignmentCenter;
    
//    CGSize size =  [self sizeWithString:self.categoryLabel.text font:self.categoryLabel.font];
    
    self.categoryLabel.layer.borderColor = [UIColor brownColor].CGColor;
    self.categoryLabel.layer.borderWidth = 0.7;
    self.categoryLabel.layer.cornerRadius = 8;
    self.categoryLabel.layer.masksToBounds = YES;
    
    self.headimageView.layer.cornerRadius = 15;
    self.headimageView.layer.masksToBounds = YES;
    

    
//    self.categoryLabel.center = self.view.center;
//    [self.view addSubview:label];

    
    [self.headimageView sd_setImageWithURL:[NSURL URLWithString:self.model.avatar_url]];
    self.NicknameLabel.text = self.model.name;
    self.texttitleLabel.text = self.model.text;
    self.categoryLabel.text = [NSString stringWithFormat:@" %@  ",self.model.category_name];
    self.diggLabel.text = [NSString stringWithFormat:@"%ld",self.model.digg_count];
    self.buryLabel.text = [NSString stringWithFormat:@"%ld",self.model.bury_count];
    self.commentlabel.text = [NSString stringWithFormat:@"%ld",self.model.comment_count];
    self.shareLabel.text = [NSString stringWithFormat:@"%ld",self.model.share_count];
    }


//白天
- (void)updateToDaySkinMode {
    self.texttitleLabel.backgroundColor = [UIColor whiteColor];
    self.texttitleLabel.textColor = [UIColor blackColor];
    self.backgroundColor = [UIColor whiteColor];
    self.diggLabel.backgroundColor = [UIColor whiteColor];
    self.diggLabel.textColor = [UIColor grayColor];
    
    
}

//夜间
- (void)updateToNightSkinMode {
    self.texttitleLabel.backgroundColor = [UIColor blackColor];
    self.texttitleLabel.textColor = [UIColor grayColor];
//    self.NicknameLabel.backgroundColor = [UIColor blackColor];
    self.NicknameLabel.textColor = [UIColor grayColor];
    self.backgroundColor = [UIColor blackColor];
    self.categoryLabel.textColor = [UIColor grayColor];
    
    self.diggLabel.backgroundColor = [UIColor blackColor];
    self.diggLabel.textColor = [UIColor grayColor];
    
//
}

//分享
- (IBAction)didClackshareBut:(id)sender {
    NSLog(@"分享");
}
//不喜欢的理由
- (IBAction)didClickdislikeBut:(id)sender {
    NSLog(@"不喜欢理由");
}
//赞
- (IBAction)didClickpraiseBut:(id)sender {
    NSLog(@"赞");
}
//不赞
- (IBAction)didClickBuzanBut:(id)sender {
    NSLog(@"不赞");
}
//评论
- (IBAction)didclickcommentsdidclickBut:(id)sender {
    NSLog(@"评论");
}



@end
